﻿<Page
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Behaviors"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:ViewModels="using:Behaviors.ViewModels"
    xmlns:Interactivity="using:Microsoft.Xaml.Interactivity" xmlns:Core="using:Microsoft.Xaml.Interactions.Core" xmlns:Custom="using:Behaviors.Custom"
    xmlns:Media="using:Microsoft.Xaml.Interactions.Media"
    x:Class="Behaviors.MainPage"
    mc:Ignorable="d">

    <Page.DataContext>
        <ViewModels:MainPageViewModel/>
    </Page.DataContext>

	<Grid Background="#FF08003B">
		<VisualStateManager.VisualStateGroups>
			<VisualStateGroup x:Name="VisualStateGroup">
				<VisualStateGroup.Transitions>
					<VisualTransition GeneratedDuration="0:0:1"/>
				</VisualStateGroup.Transitions>
				<VisualState x:Name="VisualState0"/>
				<VisualState x:Name="VisualState1">
					<Storyboard>
						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="rectangle1">
							<DiscreteObjectKeyFrame KeyTime="0">
								<DiscreteObjectKeyFrame.Value>
									<Thickness>892,188,0,0</Thickness>
								</DiscreteObjectKeyFrame.Value>
							</DiscreteObjectKeyFrame>
						</ObjectAnimationUsingKeyFrames>
						<ColorAnimation Duration="0" To="Blue" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="rectangle1" d:IsOptimized="True"/>
					</Storyboard>
				</VisualState>
			</VisualStateGroup>
		</VisualStateManager.VisualStateGroups>
		<Grid d:IsLocked="True">
			<Grid.ColumnDefinitions>
				<ColumnDefinition/>
				<ColumnDefinition/>
				<ColumnDefinition/>
				<ColumnDefinition/>
			</Grid.ColumnDefinitions>
			<Grid.RowDefinitions>
				<RowDefinition/>
				<RowDefinition/>
			</Grid.RowDefinitions>
			<Rectangle Fill="White" Stroke="Black" Opacity="0.195" d:IsLocked="True"/>
			<Rectangle Fill="White" Stroke="Black" Grid.Column="2" Opacity="0.195" d:IsLocked="True" />
			<Rectangle Fill="White" Stroke="Black" Grid.Row="1" Grid.Column="1" Opacity="0.195" d:IsLocked="True" />
			<Rectangle Fill="White" Stroke="Black" Grid.Row="1" Grid.Column="3" Opacity="0.195" d:IsLocked="True" />
			<TextBlock Grid.Column="0" Grid.Row="0" Margin="10" Style="{StaticResource SubheaderTextBlockStyle}" Text="Call Method Action" HorizontalAlignment="Center" VerticalAlignment="Top" d:IsLocked="True"/>
			<TextBlock Grid.Column="1" Grid.Row="0" Margin="10" Style="{StaticResource SubheaderTextBlockStyle}" Text="Change Property Action" HorizontalAlignment="Center" VerticalAlignment="Top" d:IsLocked="True"/>
			<TextBlock Grid.Column="2" Grid.Row="0" Margin="10" Style="{StaticResource SubheaderTextBlockStyle}" Text="Go to State Action" HorizontalAlignment="Center" VerticalAlignment="Top" d:IsLocked="True"/>
			<TextBlock Grid.Column="3" Grid.Row="0" Margin="10" Style="{StaticResource SubheaderTextBlockStyle}" Text="Invoke Command Action" HorizontalAlignment="Center" VerticalAlignment="Top" d:IsLocked="True"/>
			<TextBlock Grid.Column="0" Grid.Row="1" Margin="10" Style="{StaticResource SubheaderTextBlockStyle}" Text="Control Storyboard Action" HorizontalAlignment="Center" VerticalAlignment="Top" d:IsLocked="True"/>
			<TextBlock Grid.Column="1" Grid.Row="1" Margin="10" Style="{StaticResource SubheaderTextBlockStyle}" Text="Play Sound Action" HorizontalAlignment="Center" VerticalAlignment="Top" d:IsLocked="True"/>
			<TextBlock Grid.Column="2" Grid.Row="1" Margin="10" Style="{StaticResource SubheaderTextBlockStyle}" Text="Navigate to Page Acton" HorizontalAlignment="Center" VerticalAlignment="Top" d:IsLocked="True"/>
			<TextBlock Grid.Column="3" Grid.Row="1" Margin="10" Style="{StaticResource SubheaderTextBlockStyle}" Text="Custom Action" HorizontalAlignment="Center" VerticalAlignment="Top" d:IsLocked="True"/>
		</Grid>
		<Button Content="Refresh" HorizontalAlignment="Left" Height="98" Margin="52,64,0,0" VerticalAlignment="Top" Width="224">
			<Interactivity:Interaction.Behaviors>
				<Core:EventTriggerBehavior EventName="Click">
					<Core:CallMethodAction TargetObject="{Binding Mode=OneWay}" MethodName="ReloadData"/>
				</Core:EventTriggerBehavior>
			</Interactivity:Interaction.Behaviors>
		</Button>
		<TextBlock HorizontalAlignment="Left" Height="196" Margin="55,188,0,0" TextWrapping="Wrap" Text="{Binding ReloadDataText}" VerticalAlignment="Top" Width="237" FontSize="26.667"/>
		<Button Content="Red" HorizontalAlignment="Left" Height="92" Margin="383,67,0,0" VerticalAlignment="Top" Width="99">
			<Interactivity:Interaction.Behaviors>
				<Core:EventTriggerBehavior EventName="Click">
					<Core:ChangePropertyAction TargetObject="{Binding ElementName=rectangle}" PropertyName="Fill">
						<Core:ChangePropertyAction.Value>
							<SolidColorBrush Color="Red"/>
						</Core:ChangePropertyAction.Value>
					</Core:ChangePropertyAction>
				</Core:EventTriggerBehavior>
			</Interactivity:Interaction.Behaviors>
		</Button>
		<Button Content="Green" HorizontalAlignment="Left" Height="92" Margin="509,70,0,0" VerticalAlignment="Top" Width="99">
			<Interactivity:Interaction.Behaviors>
				<Core:EventTriggerBehavior EventName="Click">
					<Core:ChangePropertyAction TargetObject="{Binding ElementName=rectangle}" PropertyName="Fill">
						<Core:ChangePropertyAction.Value>
							<SolidColorBrush Color="#FF51FF00"/>
						</Core:ChangePropertyAction.Value>
					</Core:ChangePropertyAction>
				</Core:EventTriggerBehavior>
			</Interactivity:Interaction.Behaviors>
		</Button>
		<Rectangle x:Name="rectangle" Fill="{Binding Color}" HorizontalAlignment="Left" Height="159" Margin="386,173,0,0" Stroke="Black" VerticalAlignment="Top" Width="219"/>
		<Rectangle x:Name="rectangle1" Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="104" Margin="716,201,0,0" Stroke="Black" VerticalAlignment="Top" Width="102"/>
		<Button Content="State 1" HorizontalAlignment="Left" Height="83" Margin="729,73,0,0" VerticalAlignment="Top" Width="111">
			<Interactivity:Interaction.Behaviors>
				<Core:EventTriggerBehavior EventName="Click">
					<Core:GoToStateAction StateName="VisualState0"/>
				</Core:EventTriggerBehavior>
			</Interactivity:Interaction.Behaviors>
		</Button>
		<Button Content="State 2" HorizontalAlignment="Left" Height="83" Margin="869,79,0,0" VerticalAlignment="Top" Width="111">
			<Interactivity:Interaction.Behaviors>
				<Core:EventTriggerBehavior EventName="Click">
					<Core:GoToStateAction StateName="VisualState1"/>
				</Core:EventTriggerBehavior>
			</Interactivity:Interaction.Behaviors>
		</Button>
		<Button Content="Load Data Cmd" HorizontalAlignment="Left" Height="74" Margin="1098,82,0,0" VerticalAlignment="Top" Width="188" FontFamily="Global User Interface">
			<Interactivity:Interaction.Behaviors>
				<Core:EventTriggerBehavior EventName="Click">
					<Core:InvokeCommandAction 
						Command="{Binding LoadDataCommand, Mode=OneWay}"/>
				</Core:EventTriggerBehavior>
			</Interactivity:Interaction.Behaviors>
		</Button>
		<TextBlock HorizontalAlignment="Left" Height="211" Margin="1101,178,0,0" TextWrapping="Wrap" Text="{Binding LoadDataText}" VerticalAlignment="Top" Width="255" FontSize="17.333"/>
		<TextBox HorizontalAlignment="Left" Height="39" Margin="1076,486,0,0" TextWrapping="Wrap" Text="Hello Unni" VerticalAlignment="Top" Width="222"/>
		<Button Content="Button" HorizontalAlignment="Left" Height="80" Margin="1101,549,0,0" VerticalAlignment="Top" Width="162">
			<Interactivity:Interaction.Behaviors>
				<Core:EventTriggerBehavior EventName="Click">
					<Custom:MessageDialogAction Message="Hello World"/>
				</Core:EventTriggerBehavior>
			</Interactivity:Interaction.Behaviors>
		</Button>
		<Button Content="Go to Page 2" HorizontalAlignment="Left" Height="101" Margin="779,525,0,0" VerticalAlignment="Top" Width="151">
			<Interactivity:Interaction.Behaviors>
				<Core:EventTriggerBehavior EventName="Click">
					<Core:NavigateToPageAction TargetPage="Behaviors.Views.Page2"/>
				</Core:EventTriggerBehavior>
			</Interactivity:Interaction.Behaviors>
		</Button>
		<Button Content="Play" HorizontalAlignment="Left" Height="66" Margin="450,506,0,0" VerticalAlignment="Top" Width="125">
			<Interactivity:Interaction.Behaviors>
				<Core:EventTriggerBehavior EventName="Click">
					<Media:PlaySoundAction Source="ms-appx:///Assets/Spock.mp3"/>
				</Core:EventTriggerBehavior>
			</Interactivity:Interaction.Behaviors>
		</Button>
	</Grid>
</Page>
